<template>
  <div id="login">
    <div id="top">
      <span class="iconfont arrow_l">&#xe6bc;</span>
      <h2>手机登录</h2>
      <p>
        <span class="iconfont">&#xf0112;</span>
        <span class="iconfont">&#xe71e;</span>
        <i class="line"></i>
      </p>
    </div>
    <!-- 主体 -->
    <main>
      <div class="wrap">
        <img src="../assets/images/页面-9-手机登录_03.png" alt="" />
        <p class="box1">
          <span>手机号</span>
          <input type="text" name="" id="" v-model="form.phone" />
        </p>
        <p class="box2">
          <span>密码</span>
          <input type="text" name="" id="" v-model="form.password" />
        </p>
        <p class="but" @click="logins">登入</p>
        <span class="goregi" @click="goregister">没有账号清先注册</span>
      </div>
    </main>

    <footer></footer>
  </div>
</template>


<script >
import {login} from "../utils/api";
import {mapActions} from 'vuex'
export default {
  data() {
    return {
       form:{
          phone:"",
          password:""
          }
    };
  },
  methods: {
    ...mapActions({
      reqChangeUser:"reqChangeUser"
    }),
    logins() {
      if (
        this.form.phone != "" &&
        this.form.password != ""
      ) {
        login(this.form).then((res) => {
          if (res.data.code == 200) {
            this.reqChangeUser(res.data.list)
            alert(res.data.msg);
            setTimeout(function () {
              location.href ="/#/indexpage";
            }, 3000);
            console.log(1);
          } else {
            alert(res.data.msg);
          }
        });
      } else {
        alert("有内容为空，请写入");
      }
    },
    goregister(){
      this.$router.push("/register")
    }
  },
};
</script>

<style  socped>
@import "../assets/css/login2.css";
/*头部*/
/* #top {
  height: 0.64rem;
  padding: 0.28rem 0.1rem 0.28rem 0.33rem;
  background-color: #ff6040;
  display: flex;
  color: #ffdfd8;
  justify-content: space-between;
  align-items: center;
}
#top .arrow_l {
  font-size: 0.34rem;
}
#top h2 {
  font-size: 0.32rem;
  margin-left: 1rem;
}
#top p {
  height: 0.64rem;
  width: 1.75rem;
  display: flex;
  border: 1px solid #ff8a6f;
  box-sizing: border-box;
  border-radius: 0.64rem;
  align-items: center;
  position: relative;
}
#top p span {
  width: 50%;
  height: 100%;
  text-align: center;
  line-height: 0.64rem;
}
#top p .line {
  width: 1px;
  height: 0.38rem;
  position: absolute;
  left: 0.87rem;
  top: 0.13rem;
  background-color: #fff;
}
main {
  padding: 0.2rem 0.2rem 0;
  box-sizing: border-box;
}
main .wrap {
  height: 13.4rem;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
}
main .wrap img {
  width: 3.7rem;
  margin-top: 4.8rem;
}
main .wrap p {
  height: 0.48rem;
  width: 6.06rem;
  border-bottom: 1px solid #f7f7f7;
}
main .wrap p.box1 {
  margin-top: 1.15rem;
}
main .wrap p.box1 span {
  font-size: 0.24rem;
  color: #6a6a6a;
}
main .wrap p.box1 input {
  height: 0.46rem;
  width: 5.2rem;
  border: none;
}
main .wrap p.box2 {
  margin-top: 0.5rem;
  height: 0.78rem;
  display: flex;
  align-items: center;
}
main .wrap p.box2 span {
  font-size: 0.24rem;
  color: #6a6a6a;
}
main .wrap p.box2 input {
  height: 0.46rem;
  width: 3.5rem;
  border: none;
  border-left-color: red;
}
main .wrap p.box2 i {
  display: inline-block;
  height: 0.48rem;
  width: 1.6rem;
  text-align: center;
  line-height: 0.48rem;
  background-color: #cccccc;
  color: #fcfcfc;
  font-size: 0.2rem;
}
main .wrap .but {
  width: 6.06rem;
  height: 0.98rem;
  background-color: #cccccc;
  color: #fff;
  text-align: center;
  line-height: 0.98rem;
  font-size: 0.3rem;
  margin-top: 0.4rem;
}
footer {
  width: 2.68rem;
  height: 0.1rem;
  position: fixed;
  bottom: 0.18rem;
  left: 32.1%;
  background-color: #000;
  border-radius: 0.05rem;
} */
</style>